package com.cc.openeye.find.item.tagBriefCard

import androidx.compose.runtime.Composable
import assest.common.jh
import com.cc.openeye.borderRadius
import com.cc.openeye.find.entity.find.Item
import com.cc.openeye.height
import com.cc.openeye.padding
import com.cc.openeye.width
import com.tencent.kuikly.compose.coil3.rememberAsyncImagePainter
import com.tencent.kuikly.compose.foundation.Image
import com.tencent.kuikly.compose.foundation.border
import com.tencent.kuikly.compose.foundation.layout.Box
import com.tencent.kuikly.compose.foundation.layout.Row
import com.tencent.kuikly.compose.foundation.layout.fillMaxWidth
import com.tencent.kuikly.compose.foundation.layout.padding
import com.tencent.kuikly.compose.foundation.layout.size
import com.tencent.kuikly.compose.material3.Text
import com.tencent.kuikly.compose.resources.painterResource
import com.tencent.kuikly.compose.ui.Alignment
import com.tencent.kuikly.compose.ui.Modifier
import com.tencent.kuikly.compose.ui.graphics.Color
import com.tencent.kuikly.compose.ui.layout.ContentScale
import com.tencent.kuikly.compose.ui.text.font.FontWeight
import com.tencent.kuikly.compose.ui.text.style.TextOverflow
import com.tencent.kuikly.compose.ui.unit.dp
import com.tencent.kuikly.compose.ui.unit.sp

@Composable
fun TagBriefCard(item: Item) {
    Box(
        modifier = Modifier.fillMaxWidth()
            .padding(top = 9.dp, bottom = 9.dp, start = 15.dp, end = 15.dp)
    ) {
        Image(
            rememberAsyncImagePainter(item.data?.icon),
            contentDescription = "img",
            modifier = Modifier.size(50.dp).borderRadius(5.dp),
            contentScale = ContentScale.Crop
        )

        Box(modifier = Modifier.height(50f).padding(start = 50f, end = 50f)) {
            Text(
                item.data?.title ?: "",
                color = Color(0Xff333333),
                fontSize = 14.sp,
                modifier = Modifier.padding(start = 15.dp),
                fontWeight = FontWeight.W600
            )

            Text(
                item.data?.description ?: "",
                color = Color(0Xff888888),
                fontSize = 14.sp,
                modifier = Modifier.padding(start = 14.dp).align(Alignment.BottomStart),
                fontWeight = FontWeight.W400,
                maxLines = 1,
                overflow = TextOverflow.Ellipsis
            )
        }

        Row(
            modifier = Modifier.borderRadius(5.dp)
                .border(width = 1.dp, color = Color(0xFF444444))
                .padding(start = 8.dp, end = 8.dp, top = 5.dp, bottom = 5.dp)
                .align(alignment = Alignment.CenterEnd),
            verticalAlignment = Alignment.CenterVertically
        ) {
            Image(
                painter = painterResource(jh),
                contentDescription = "加号",
                modifier = Modifier
                    .width(12f).height(12f),
                contentScale = ContentScale.FillBounds
            )

            Text(
                "关注",
                color = Color(0Xff333333),
                fontSize = 10.sp,
                fontWeight = FontWeight.W600,
            )
        }

    }
}